<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en">

  <head>
    <meta http-equiv="Content-Type"
          content="text/html;charset=utf-8" />

    <title>
        aR programme used.txt
        &mdash;
        Economics E-Journal
    </title>

    
      
        <base href="http://www.economics-ejournal.org/datasets/discussion-paper-2009-22/aR%20program%20used.txt" />
      
    

    <meta name="generator" content="Plone - http://plone.org" />


    <!-- Plone ECMAScripts -->
    
      
        
            
                <script type="text/javascript"
                        src="http://www.economics-ejournal.org/portal_javascripts/eJournalTheme/ploneScripts2266.js">
                </script>
                
            
            
                <script type="text/javascript"
                        src="http://www.economics-ejournal.org/portal_javascripts/eJournalTheme/ploneScripts2898.js">
                </script>
                
            
        
    
    

    
	
          
        
            
                
                    
                    
                        <style type="text/css"><!-- @import url(http://www.economics-ejournal.org/portal_css/eJournalTheme/ploneStyles7103.css); --></style>
                    
                    
                
            
            
                
                    <link rel="alternate stylesheet"
                          type="text/css" media="screen"
                          href="http://www.economics-ejournal.org/portal_css/eJournalTheme/ploneStyles6006.css"
                          title="Small Text" />
                    
                    
                
            
            
                
                    <link rel="alternate stylesheet"
                          type="text/css" media="screen"
                          href="http://www.economics-ejournal.org/portal_css/eJournalTheme/ploneStyles4517.css"
                          title="Large Text" />
                    
                    
                
            
            
                
                    
                    
                        <style type="text/css"><!-- @import url(http://www.economics-ejournal.org/portal_css/eJournalTheme/ploneStyles6302.css); --></style>
                    
                    
                
            
        
    
        
        
    

    <!-- Internet Explorer CSS Fixes -->
    <!--[if lt IE 7]>
        <style type="text/css" media="all">@import url(http://www.economics-ejournal.org/IEFixes.css);</style>
    <![endif]-->

    <link rel="shortcut icon" type="image/x-icon"
          href="http://www.economics-ejournal.org/favicon.ico" />

    <link rel="home"
          href="http://www.economics-ejournal.org"
          title="Front page" />
    <link rel="search"
          href="http://www.economics-ejournal.org/search_form"
          title="Search this site" />
    <link rel="author"
          href="http://www.economics-ejournal.org/author/kwerner"
          title="Author information" />
    <link rel="contents"
          href="http://www.economics-ejournal.org/sitemap"
          title="Site Map" />

    

    

    <link rel="up"
          href="http://www.economics-ejournal.org/datasets/discussion-paper-2009-22"
          title="Up one level" />

    

    <!-- Disable IE6 image toolbar -->
    <meta http-equiv="imagetoolbar" content="no" />

    
      
      
    

    

      
    
    
    
    


      
      
    

    
      
      
  

  </head>

  <body class="section-datasets" dir="ltr">
    <div id="visual-portal-wrapper">

      <div id="portal-top">

        <div id="portal-header">
          <a class="hiddenStructure" accesskey="2"
             href="http://www.economics-ejournal.org/datasets/discussion-paper-2009-22/aR%20program%20used.txt/view#documentContent">Skip to content.</a>

          <a class="hiddenStructure" accesskey="6"
             href="http://www.economics-ejournal.org/datasets/discussion-paper-2009-22/aR%20program%20used.txt/view#portlet-navigation-tree">Skip to navigation</a>

          </div>

      </div>

<!-- new head================================================= -->    
     
        
        <table id="top-line">
            <tr>
                <td style="vertical-align:top;">
        
            
            <ul id="portal-siteactions">

    <li id="siteaction-home"><a
    href="http://www.economics-ejournal.org" accesskey=""
    title="Home">Home</a></li>
    <li id="siteaction-legal"><a
    href="http://www.economics-ejournal.org/imprint"
    accesskey="" title="Legal">Legal</a></li>
    <li id="siteaction-contact"><a
    href="http://www.economics-ejournal.org/contact-info"
    accesskey="9" title="Contact &amp; Suggestions">Contact &amp; Suggestions</a></li>
    <li id="siteaction-alerting_service"><a
    href="http://www.economics-ejournal.org/alerting_service_form"
    accesskey="" title="Alerting Service">Alerting Service</a></li>
    <li id="siteaction-login"><a
    href="http://www.economics-ejournal.org/login_form"
    accesskey="" title="Login">Login</a></li>


   

    </ul>
        </td>
        <td style="vertical-align:top; text-align:right;">
           <div id="portal-searchbox">
    <form name="searchform"
          action="http://www.economics-ejournal.org/search"
          style="white-space:nowrap" onsubmit="">

        <label for="searchGadget" class="hiddenStructure">Search Site</label>

        <div class="LSBox">
            
           <input class="ej_search_button" type="submit"
                  value="" />


            
            <input id="searchGadget" name="SearchableText"
                   type="text" size="18" value="Search"
                   title="Search Site" accesskey="4"
                   class="visibility:visible"
                   onclick="this.value=''" />

           <!--   <div id="advanced-search-label">            
            <a href="#"
               tal:attributes="href string:$portal_url/search_form">Advanced Search...</a>               
       </div> -->
              
        <div class="LSResult" id="LSResult" style=""><div class="LSShadow" id="LSShadow"></div></div>
        </div>
    </form>

    <div id="portal-advanced-search" class="hiddenStructure">
        <a href="http://www.economics-ejournal.org/search_form"
           accesskey="5">
            Advanced Search&hellip;
        </a>
    </div>

</div>
        </td>
        </tr>
    </table>

          
        <div id="head-right">

           <div>
 
     
     
    <h5 class="hiddenStructure">Logins></h5>
     

    <div id="portal-logins">
        <span class="ejournal_login_label">Login as:</span><br />  

        
        <a href="http://www.economics-ejournal.org/misc/login-as-author">Author</a> <br />
        <a href="http://www.economics-ejournal.org/misc/login-as-associate-editor">Associate Editor</a> <br />
            
         
            <p>
            <a href="http://www.economics-ejournal.org/login_form">Registered Reader</a>
            </p>
          
                
            <a id="register"
               href="http://www.economics-ejournal.org/createMember">Register now!</a>
     
        
        
    
    
    </div>

</div>


           <div id="portal-personaltools-wrapper">

<h5 class="hiddenStructure">Personal tools</h5>

<div id="ej-personaltools">
   

    





</div>
</div>



        </div>
        


           
    <div id="economics-head">

                    
          <div id="logo">
              
              <a href="http://www.economics-ejournal.org"><img src="logo.png" /></a>
          </div>

              
         
    </div>



<!--- new head end ========================================-->      
      <div class="visualClear" style="margin-bottom:15px;"><!-- --></div>
      
      

      

            
            <div id="portal-column-one">
              <div class="visualPadding">
                
                  

    
        

        
            
       
<dl class="portlet" id="portlet-navigation-tree">
    <dt>
    </dt>
    
    <dd class="portletItem lastItem">
        <ul class="portletNavigationTree navTreeLevel0">
           
            
                
                
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
          
          
            
            
            <!--Rubriken Titel ohne Link -->
            <span class="economics_nav0_title" title="">

                                             

                     
                     

                <span>Economics</span>

          
            </span>
            
                  
             
      </div>

      <ul class="navTree navTreeLevel1">
            
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics/journalarticles"
                 class="state-visible visualIconPadding"
                 title="Articles in economics are economics discussion papers that have been selected for publication as journal articles in economics as result of the referee process and the public peer review process. In the ongoing open assessment of published articles readers are asked to rate articles on a scale from 5 (exellent) to 1 (bad) and take part in the evaluation process by uploading comments.">

                <img src="icon_ja.gif" />                             

                <span>Journal Articles</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics/discussionpapers"
                 class="state-published visualIconPadding"
                 title="The economics discussion paper series contains all recent contributions that are open for discussion while pending acceptance for publication as journal articles in economics, as well as all older papers that have either been accepted or rejected for publication as journal articles in economics.">

                <img src="icon_dp.gif" />                             

                <span>Discussion Papers</span>
              </a>
            
             
      </div>

      
    
</li>


      </ul>
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
          
          
            
            
            <!--Rubriken Titel ohne Link -->
            <span class="economics_nav0_title" title="">

                                             

                     
                     

                <span>Special Areas</span>

          
            </span>
            
                  
             
      </div>

      <ul class="navTree navTreeLevel1">
            
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/special-areas/surveys-and-overviews"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Surveys and Overviews</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/special-areas/policy-papers"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Policy Papers</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/special-areas/special-issues"
                 class="state-visible visualIconPadding"
                 title="Special issues are a collection of papers on a specific topic. They are compiled by an editor who is responsible for the selection of contributions to a special issue. Note that all special issue papers can also be found as ordinary contributions in the economics discussion paper series or in economics.">

                                             

                <span>Special Issues</span>
              </a>
            
             
      </div>

      
    
</li>


      </ul>
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
          
          
            
            
            <!--Rubriken Titel ohne Link -->
            <span class="economics_nav0_title" title="">

                                             

                     
                     

                <span>Submission</span>

          
            </span>
            
                  
             
      </div>

      <ul class="navTree navTreeLevel1">
            
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/submission/submit-article"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Submit Paper</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/submission/instructions-for-authors"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Guidelines for Authors</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/submission/data-availability-policy"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Data Availability Policy</span>
              </a>
            
             
      </div>

      
    
</li>


      </ul>
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
          
          
            
            
            <!--Rubriken Titel ohne Link -->
            <span class="economics_nav0_title" title="">

                                             

                     
                     

                <span>Conception</span>

          
            </span>
            
                  
             
      </div>

      <ul class="navTree navTreeLevel1">
            
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/economics-at-a-glance"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Economics at a Glance</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/aims-and-scope"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Aims and Scope</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/two-stage-publication-process"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Review Process </span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/archiving-and-dissemination"
                 class="state-published visualIconPadding"
                 title="">

                                             

                <span>Archiving and Dissemination</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/awards"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Prizes</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/about-economics/copyright-agreement"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>License Agreements</span>
              </a>
            
             
      </div>

      
    
</li>


      </ul>
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
          
          
            
            
            <!--Rubriken Titel ohne Link -->
            <span class="economics_nav0_title" title="">

                                             

                     
                     

                <span>Community</span>

          
            </span>
            
                  
             
      </div>

      <ul class="navTree navTreeLevel1">
            
            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics-community/editorial-board"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Editorial Board</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics-community/advisory-board"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Advisory Board</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics-community/associated-editors"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Associate Editors</span>
              </a>
            
             
      </div>

      <ul class="navTree navTreeLevel2">
            
            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            



            




      </ul>
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics-community/list-of-authors"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Authors</span>
              </a>
            
             
      </div>

      
    
</li>

            

<li class="navTreeItem visualNoMarker">

    
    
      <div>
                  
                          
          
            

            
              <a href="http://www.economics-ejournal.org/economics-community/registered-readers"
                 class="state-visible visualIconPadding"
                 title="">

                                             

                <span>Registered Readers</span>
              </a>
            
             
      </div>

      
    
</li>


      </ul>
    
</li>


                
            
        </ul>
        <span class="portletBottomLeft"></span>
        <span class="portletBottomRight"></span>
    </dd>
</dl>


        

        

        
    

                
                &nbsp;
              </div>
            </div>
            

            
            
                <div id="portal-column-two">
                <div class="visualPadding">
                    
                    

    
        

        
            
        

        

        
    
    
        

        
            
        

        

        
    
    
        

        
            
        

        

        
    
    
        

        
            
        

        

        
    
    
        

        
            
        

        

        
    
    
        

        
            
        

        

        
    

                    
                    &nbsp;
                </div>
                </div>
            
                                   
            
            <div id="portal-column-content">

              
                <div id="content" class="">

                  
                  <div class="documentContent" id="region-content">

                  
                  
                    <a name="documentContent"></a>

                    
                  
                  
                  

                    

                    <div>
    
        <div>
</div>

        <h1 class="documentFirstHeading">aR programme used.txt</h1>
    
        

        
    
        <p>
            <a href="http://www.economics-ejournal.org/datasets/discussion-paper-2009-22/aR%20program%20used.txt">
                <img src="http://www.economics-ejournal.org/txt.png"
                     alt="" />
                
                Click here to get the file
                
            </a>
        </p>
    
        <small class="discreet">
            <span>
            Size
            </span>
            
            <span>2.1 kB</span>
    
            
    
            -
            
            <span>
            File type
            </span>
    
            <span>text/plain</span>
        </small>
    
        <div class="row">
    
                <h2>File contents</h2>
    
                <pre>######## updating in delta t
library(MSBVAR)
#example last
yt =t(t(c(0.001057,4.524024)))
YHATtp1 = t(t(c(0.004574,4.5837)))
sigma = 	c(0.0000358,	0.0000665, 0.0000665,	0.005963)
dim(sigma) = c(2,2)

lcsi10 =log(82)
lcsi11 =log(85.5)
lcsi12 =log(92)
YHAT1_TDT = yt[1]+0.33*(YHATtp1[1]-yt[1])+sigma[1,2]*solve(sigma[2,2])*(lcsi10-yt[2]-0.33*(YHATtp1[2]-yt[2]))
updateYHATtp1 = t(t(c(YHAT1_TDT,lcsi10)))+(0.66)*(YHATtp1-yt)
YHAT1_TDT2 = yt[1]+0.66*(YHATtp1[1]-yt[1])+sigma[1,2]*solve(sigma[2,2])*(lcsi11-yt[2]-0.66*(YHATtp1[2]-yt[2]))
updateYHATtp12 = t(t(c(YHAT1_TDT2,lcsi11)))+(0.33)*(YHATtp1-yt)
YHATtp1
updateYHATtp1
updateYHATtp12

mdata=read.csv("pce.csv",header=T)
attach(mdata)
mcsi=read.csv("consumer_sentiment_index.csv",header=T)
attach(mcsi)
length(CSIM)

dim(CSIM) = c(3,138)
CSIMM = t(CSIM)
CSIp1 = CSIMM[33:138,2]
CSIp2 = CSIMM[33:138,3]

length(CSIp1)
length(CSI)
swt = 1
n = 10

se = matrix(0,n,2)
se1 = se
se2 = se
se[21]

for (T in (105-n+1):105) {

#T = 105
#CSIp1[106]

dlogpce = log(PCE[2:T])-log(PCE[1:(T-1)])
lcsi    = log(CSI[2:T])
lcsip1  = log(CSIp1[2:T])
lcsip2  = log(CSIp2[2:T])
ytp1 = c((log(PCE[(T+1)])-log(PCE[(T)])),log(CSI[(T+1)]))



Y = ts(cbind(dlogpce,lcsi))
varm = reduced.form.var(Y, 5)
forecasts = forecast(varm,nsteps=1)
yt =as.matrix(Y[(T-1),])
YHATtp1 = as.matrix(forecasts[T,])
sigma = varm$vcv

lcsi10 =lcsip1[(T-1)]
lcsi11 =lcsip2[(T-1)]

YHAT1_TDT = yt[1]+0.33*(YHATtp1[1]-yt[1])+swt*sigma[1,2]*solve(sigma[2,2])*(lcsi10-yt[2]-0.33*(YHATtp1[2]-yt[2]))
updateYHATtp1 = t(t(c(YHAT1_TDT,lcsi10)))+(0.66)*(YHATtp1-yt)
YHAT1_TDT2 = yt[1]+0.66*(YHATtp1[1]-yt[1])+swt*sigma[1,2]*solve(sigma[2,2])*(lcsi11-yt[2]-0.66*(YHATtp1[2]-yt[2]))
updateYHATtp12 = t(t(c(YHAT1_TDT2,lcsi11)))+(0.33)*(YHATtp1-yt)
YHATtp1
updateYHATtp1
updateYHATtp12
ytp1
i = T - (105-n)
se[i,]=(YHATtp1-ytp1)*(YHATtp1-ytp1)
se1[i,]=(updateYHATtp1-ytp1)*(updateYHATtp1-ytp1)
se2[i,]=(updateYHATtp12-ytp1)*(updateYHATtp12-ytp1)
}
sum(se[,1])
sum(se1[,1])
sum(se2[,1])

sqrt(mean(se[,1]))
sqrt(mean(se1[,1]))

sqrt(mean(se[,1]))
sqrt(mean(se2[,1]))

</pre>

        </div>

        <div id="relatedItems">
    
        
            
        
    
</div>
    
    
</div>

                    
                      
                 
    

        
    

                    

                  </div>

                </div>

              
            </div>
            

      

      
      
      <div class="visualClear"><!-- --></div>


      
    <div id="portal-footer">
        Sponsors and Partners:  <br />
        
        <a href="http://www.ifw-kiel.de"><img src="partner-logo.ifw.jpg" alt="Kiel Institute for the World Economy" /></a>


        <a href="http://www.zbw.eu"><img src="partner-logo.zbw.gif" alt="German National Library of Economics (ZBW)" /></a>

        <a href="http://www.dfg.de"><img src="partner-logo.dfg.gif" alt="Deutsche
            Forschungsgemeinschaft (DFG)" /></a>

        <a href="http://open-access.net"><img src="partner-logo.openaccess.gif" alt="OpenAccess-Net" /></a>
        <br />


        <a href="http://www.economics-ejournal.org/sponsored-by/basf"
           title="BASF">BASF</a>,

        <a href="http://www.economics-ejournal.org/sponsored-by/e.on-1"
           title="E.ON">E.ON</a>,

        <a href="http://www.economics-ejournal.org/sponsored-by/02"
           title="O2">O2</a>,

        <a href="http://www.economics-ejournal.org/sponsored-by/financial-times-deutschland"
           title="Financial Times Deutschland">Financial
            Times Deutschland</a>,

        <a href="http://www.soros.org/openaccess/" title="Budapest Open
            Access Initiative">Budapest Open Access Initiative</a>


        <br />
        <a href="http://plone.org" title="Powered by Plone CMS and other Open Source Software (FreeBSD, Linux, Vim, Apache, Python...">
            Powered by Plone® CMS — Open Source Content
            Management System</a>
        


    </div>



    </div>

</body>
</html>

